package com.bjdd.jdy.ui.working;

import com.bjdd.jdy.base.BaseResult;
import com.bjdd.jdy.entity.OrderResult;
import com.bjdd.jdy.entity.result.TodayDataResult;
import com.bjdd.jdy.util.Api;
import com.bjdd.jdy.util.RxSchedulers;

import rx.Observable;

/**
 * Created by Administrator on 2017/5/2.
 */

public class WorkingModel implements WorkingContract.Model {
    @Override
    public Observable<BaseResult<TodayDataResult>> getTodayData(String token, String userId) {
        return Api.getInstance().service
                .todayData(token,userId)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<BaseResult<String>> start(String token, String carrierId) {
        return Api.getInstance().service
                .start(token,carrierId)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<BaseResult<String>> stop(String token, String carrierId) {
        return Api.getInstance().service
                .stop(token,carrierId)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<BaseResult<OrderResult>> queryWaitOrder(String token,String cityName, int page, int size) {
        return Api.getInstance().service
                .queryWaitOrder(token,page,cityName,size)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<BaseResult<OrderResult>> queryOrder(String token, String carrierId, int type, int page, int size) {
        return Api.getInstance().service
                .queryOrders(token,carrierId,type,page,size)
                .compose(RxSchedulers.io_main());
    }

    @Override
    public Observable<BaseResult<String>> grab(String token, String carrierId, long orderId) {
        return Api.getInstance().service
                .grba(token,carrierId,orderId)
                .compose(RxSchedulers.io_main());
    }


}
